package com.enrollandpay.base;

import com.enrollandpay.utils.CommonUtil;
import com.enrollandpay.utils.ResultJson;
import tk.mybatis.mapper.common.Mapper;


public abstract class BaseService<T, M extends Mapper<T>> extends MBaseService<T, M>
{
    /**
     * 根据复数的pk删除数据
     * @param pkStr
     *          按separatorChar拼接的pk
     * @param separatorChar
     *          分割符
     */
    public ResultJson deleteEntitiesByPK(String pkStr, Character separatorChar)
    {
        ResultJson resultJson = new ResultJson();
        Integer[] pks = CommonUtil.stringToIntegerArr(pkStr, separatorChar);    // 将String[]转为Integer[]
        if (pks != null)
        {
            for (Integer pk : pks)
                super.deleteByPrimaryKey(pk);

            return resultJson;
        }

        resultJson.setStatus("0");
        return resultJson;
    }
}
